﻿<Window x:Class="Bugger.Proxy.TFS.Presentation.UriHelpWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:c="clr-namespace:BigEgg.Framework.Presentation.Converters;assembly=BigEgg.Framework"
        xmlns:p="clr-namespace:Bugger.Proxy.TFS.Presentation.Properties"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:dd="clr-namespace:Bugger.Proxy.TFS.Presentation.DesignData"
        xmlns:vm="clr-namespace:Bugger.Proxy.TFS.ViewModels;assembly=Bugger.Proxy.TFS"
        mc:Ignorable="d" d:DataContext="{d:DesignInstance dd:SampleUriHelpViewModel, IsDesignTimeCreatable=True}"
        Title="{Binding Title, Mode=OneWay}"
        Width="400" Height="300" ResizeMode="NoResize" Topmost="True" Closing="Window_Closing" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
    <Window.Resources>
        <Style TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="True">
                    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>

    <Grid Margin="10" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="130"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Label Content="{x:Static p:Resources.NameOrURIofTFS}" Grid.Row="0" Grid.ColumnSpan="4" VerticalAlignment="Center" HorizontalAlignment="Left" Target="{Binding ElementName=TFSName}"/>
        <TextBox x:Name="TFSName" Text="{Binding ServerName, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Grid.Row="1" VerticalAlignment="Center" Grid.ColumnSpan="4" Margin="0,4"/>
        <GroupBox Header="{x:Static p:Resources.ConnectionDetails}" Margin="0" Grid.Row="2" Grid.ColumnSpan="4" IsEnabled="{Binding CanEditConnectionDetail}">
            <Grid Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80"/>
                    <ColumnDefinition Width="80"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Label Content="{x:Static p:Resources.Path}" VerticalAlignment="Center" Target="{Binding ElementName=TFSPath}"/>
                <Label Content="{x:Static p:Resources.PortNumber}" VerticalAlignment="Center" Grid.Row="1" Target="{Binding ElementName=TFSPort}"/>
                <Label Content="{x:Static p:Resources.Protocal}" VerticalAlignment="Center" Grid.Row="2" Target="{Binding ElementName=httpRadioButton}"/>
                <TextBox x:Name="TFSPath" Grid.ColumnSpan="2" Grid.Column="1" Text="{Binding Path, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" VerticalAlignment="Center"/>
                <TextBox x:Name="TFSPort" Grid.Column="1" Margin="0" Grid.Row="1" TextWrapping="Wrap" Text="{Binding Port, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" VerticalAlignment="Center"/>
                <RadioButton x:Name="httpRadioButton" Content="{x:Static p:Resources.HTTP}" Grid.Column="1" HorizontalAlignment="Left" Margin="0" Grid.Row="2" VerticalAlignment="Center" IsChecked="{Binding IsHttpsProtocal, Converter={x:Static c:InvertBooleanConverter.Default}}"/>
                <RadioButton Content="{x:Static p:Resources.HTTPS}" Grid.Column="2" HorizontalAlignment="Left" Margin="0" Grid.Row="2" VerticalAlignment="Center" IsChecked="{Binding IsHttpsProtocal}"/>
            </Grid>
        </GroupBox>
        <Label Content="{x:Static p:Resources.Preview}" Grid.Row="3" VerticalAlignment="Center" Target="{Binding ElementName=PreviewString}"/>
        <TextBox x:Name="PreviewString" Grid.ColumnSpan="3" Grid.Column="1" Height="23" Margin="0" Grid.Row="3" TextWrapping="Wrap" Text="{Binding UriPreview, Mode=OneWay}" VerticalAlignment="Center"/>
        <Button Content="{x:Static p:Resources.OK}" Grid.Column="2" HorizontalAlignment="Right" Margin="0" Grid.Row="4" VerticalAlignment="Bottom" Width="75" Height="25" Command="{Binding SubmitCommand, Mode=OneWay}" IsDefault="True"/>
        <Button Content="{x:Static p:Resources.Cancel}" Grid.Column="3" HorizontalAlignment="Right" Margin="0" Grid.Row="4" VerticalAlignment="Bottom" Width="75" Height="25" Command="{Binding CancelCommand, Mode=OneWay}" IsCancel="True"/>
    </Grid>
</Window>